import request from '@/utils/request'

// 查询财务明细列表
export function listExpenses(query) {
  return request({
    url: '/finance/expenses/list',
    method: 'get',
    params: query
  })
}

// 查询财务明细详细
export function getExpenses(id) {
  return request({
    url: '/finance/expenses/' + id,
    method: 'get'
  })
}

// 新增财务明细
export function addExpenses(data) {
  return request({
    url: '/finance/expenses',
    method: 'post',
    data: data
  })
}

// 修改财务明细
export function updateExpenses(data) {
  return request({
    url: '/finance/expenses',
    method: 'put',
    data: data
  })
}

// 删除财务明细
export function delExpenses(id) {
  return request({
    url: '/finance/expenses/' + id,
    method: 'delete'
  })
}

// 根据来源单号删除财务记录
export function deleteExpensesBySourceSn(sourceSn) {
    return request({
        url: '/finance/expenses/deleteBySourceSn',
        method: 'post',
        params: { sourceSn }
    })
}
